package de.gruessing.gwtsports.server.xmlparser.tcxparser;

import java.io.File;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;

import de.gruessing.gwtsports.server.data.tcdata.ObjectFactory;
import de.gruessing.gwtsports.server.xmlparser.XMLParser;

public class TCXParserImpl implements XMLParser
{
	@Override
	public JAXBElement<?> parseXML( File in_xXML )
	{
		try
		{						
			JAXBContext xJAXBContext = JAXBContext.newInstance(ObjectFactory.class);
			Unmarshaller xUnmarshaller = xJAXBContext.createUnmarshaller();
				
			JAXBElement<?> xJAXBElement = 
					 (JAXBElement) xUnmarshaller.unmarshal( in_xXML );
			return xJAXBElement;
		}
		catch( JAXBException ex )
		{
			return null;
		}
	}
}
